<!DOCTYPE html>
<html>
<head>
	<title>新增/修改表单</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<link rel="stylesheet" href="__PUBLIC__/Admin/css/min.css" />
	<link rel="stylesheet" href="__PUBLIC__/Admin/content/style.css" />

	<!-- jQuery AND jQueryUI -->
	<script type="text/javascript" src="__PUBLIC__/Admin/js/libs/jquery/1.6/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Admin/js/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Admin/js/min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Admin/content/main.js"></script>
</head>
<body>
<!-- CONTENT -->
<div id="content" class="white">

  <div class="bloc">
    <div class="title">
		<?php
			if(I('get.id')){
				echo '编辑';
			}else{
				echo '新增';
			}
		?>表单
	</div>
    <form method="post" action="editOperation">
		<?php
			$id = I('get.id');
			if($id){
				echo "<input type='hidden' name='id' value='".$id."'/>";
			}
		?>
    <div class="content">
		<?php
			 if(!$id){?>
				<input type="button" value="+" onclick="javascript:addfield()">
				<input type="button" value="-" onclick="javascript:removefield()">
		<?php }?>
		<script>
			function addfield(){
				jQuery('#t2 tbody').append(
				"<tr>"+
				"<td><input name='dbname[]' value=''/><td/>"+
				"<td><input name='fieldname[]' value=''/><td/>"+
				"</tr>"
				);
			}
			function removefield(){
				jQuery('#t2 tbody tr:last').remove();
			}
		</script>
      <div class="input">
		<table>
		  <tr>
			<td>数据库名称:
				<input name="formname" value="{$object['formname']}" <?php if($id){ echo 'readonly=readonly';}?>/>
			<td/>
			<td>表名称:<input name="showname" value="{$object['showname']}"/><td/>
		  </tr>
		<table/>
		<table id='t2'>
			  <tr>
				<th>数据库字段名</th>
				<th>显示名</th>
			  </tr>
		<?php
			 if($id){?>
		  <volist name='fieldList' id='vo'>
			  <tr>
				<td>
					<input name="fieldid[]" value="{$vo.id}" type='hidden'/>
					<input name="dbname[]" value="{$vo.dbname}" readonly=readonly/>
				<td/>
				<td><input name="fieldname[]" value="{$vo.fieldname}"/><td/>
			  </tr>
		  </volist>
		<?php
			} 
		?>
		<table/>
      </div>
      <div class="submit">
        <input type="submit" value="确定保存" class="black"/>
      </div>
    </div>
    </form>
  </div>
</div>
</body>
</html>